exports.cashCoupon = function (req, res) {

    //获取restful参数
    var restfulParams = req.routeInfo.restfulParams;

    //最终结果
    var resultData = [];

    var skip  =  restfulParams.skip == undefined  ? 0 : restfulParams.skip;
    var limit =  restfulParams.limit == undefined ? config.publicConfig.LIMIT : restfulParams.limit;
    var nowTime = common.nowTime();
    var ccData  = [];
    //任务流创建
    async.waterfall([
            //1.代金券
            function (cb) {
                ////console.log(CORE_APIConfig.coreAPI.userCashCoupon + "/ucc_uid/" + restfulParams.u_id + "/skip/" + skip + "/limit/" + limit);
                R.SEND_HTTP(
                    req,
                    {
                        url: CORE_APIConfig.coreAPI.userCashCoupon + "/ucc_is_used/0/sort_order/cc_create_time-desc/ucc_uid/" + restfulParams.u_id + "/skip/" + skip + "/limit/" + limit,
                        method: 'GET',
                        data: {
                            fields: ["ucc_id","ucc_is_used","cc_desc","cc_name","cc_price","cc_start_time","cc_end_time","o_name"].join(",")
                        }
                    },
                    function (err, data) {
                        //console.log(data);
                        //判断是否有错误信息
                        if (err) {

                            return cb(err, data);
                        }
                            ccData = data.data;
                        for (var i=0 ; i<data.data.length ; i++){
                            if(ccData[i].cc_end_time>nowTime){
                                resultData.push(ccData[i]);
                            }
                        }
                        cb();
                    }
                );

            }
        ], function (err, result) {

            //返回最终拼接结果
            RES.response(res, true, resultData);

        }
    );

}